package com.meida.student.app.user.controller;

import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.security.OpenHelper;
import com.meida.module.bus.provider.service.AppUserMineService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 我的
 *
 * @author flyme
 * @date 2021-08-03
 */
@RestController
@RequestMapping("/mine/")
public class ApiMineController {

    @Autowired
    private AppUserMineService appUserMineService;


    @ApiOperation(value = "学霸我的", notes = "学霸我的")
    @GetMapping(value = "getMineIncomeInfo")
    public ResultBody getMineIncomeInfo() {
        Long userId = OpenHelper.getUserId();
        return appUserMineService.getMineIncomeInfo(userId);
    }

    @ApiOperation(value = "学霸收入中心", notes = "学霸收入中心")
    @GetMapping(value = "getIncomeCenter")
    public ResultBody getIncomeCenter() {
        Long userId = OpenHelper.getUserId();
        return appUserMineService.getIncomeCenter(userId);
    }

    @ApiOperation(value = "我的认证", notes = "我的认证")
    @GetMapping(value = "getUserScholartyrant")
    public ResultBody getUserScholartyrant(Long userId) {
        return appUserMineService.getUserScholartyrant(userId);
    }

    @ApiOperation(value = "用户资料", notes = "用户资料")
    @GetMapping(value = "getUserMineInfo")
    public ResultBody getUserMineInfo() {
        Long userId = OpenHelper.getUserId();
        return appUserMineService.getUserMineInfo(userId);
    }

    @ApiOperation(value = "修改资料", notes = "修改资料")
    @PostMapping(value = "updateUserMineInfo")
    public ResultBody updateUserMineInfo(@RequestParam(required = false) Map params) {
        return appUserMineService.updateUserMineInfo(params);
    }

    @ApiOperation(value = "学霸用户资料", notes = "学霸用户资料")
    @GetMapping(value = "getScholarTyrantMineInfo")
    public ResultBody getScholarTyrantMineInfo() {
        Long userId = OpenHelper.getUserId();
        return appUserMineService.getScholarTyrantMineInfo(userId);
    }

    @ApiOperation(value = "修改资料", notes = "修改资料")
    @PostMapping(value = "updateScholarTyrantMineInfo")
    public ResultBody updateScholarTyrantMineInfo(@RequestParam(required = false) Map params) {
        return appUserMineService.updateScholarTyrantMineInfo(params);
    }

    @ApiOperation(value = "获取分享图片", notes = "获取分享图片")
    @GetMapping(value = "getShareImage")
    public ResultBody getShareImage(Long userId) {
        return appUserMineService.getShareImage(userId);
    }


    @ApiOperation(value = "获取分享图片", notes = "获取分享图片")
    @GetMapping(value = "getShareContentImage")
    public ResultBody getShareContentImage(Long contentId) {
        return appUserMineService.getShareContentImage(contentId);
    }




}
